package com.example.rocketmq.dao;


import com.example.rocketmq.pojo.Order;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface OrderDao extends JpaRepository<Order,Long> {




    @Transactional
    @Modifying//增删改必须有这个注解
    @Query(value = "update t_order set o_type = :o_type  where order_no = :order_id ",nativeQuery = true)
    int updateStatusById(String o_type,String order_id);

    @Query(value = "select id, order_no,o_type from t_order where order_no = :order_id ",nativeQuery = true)
    List<Order> queryByOrder_no(String order_id);

}
